# use third libs
set(utils_SOURCE_DIR ${THIRD_LIB}/utils)

SET(PCH_FILE
  ${utils_SOURCE_DIR}/pch.hpp)
  
SET(ERC_FILE
  ${utils_SOURCE_DIR}/erc.hpp)
  
SET(HTTP_FILE
  ${utils_SOURCE_DIR}/http_rep.h
  ${utils_SOURCE_DIR}/http_rep.cpp
  ${utils_SOURCE_DIR}/http_srv.h
  ${utils_SOURCE_DIR}/http_srv.cpp
  ${utils_SOURCE_DIR}/http_client.hpp)

SET(MODULE_FILE
  ${utils_SOURCE_DIR}/archives.hpp
  ${utils_SOURCE_DIR}/exchange.hpp
  ${utils_SOURCE_DIR}/module.h
  ${utils_SOURCE_DIR}/module.cpp)

set(LOGGER_FILES
  ${utils_SOURCE_DIR}/logger.h
  ${utils_SOURCE_DIR}/logger.cpp)

set(CONFIG_FILES
  ${utils_SOURCE_DIR}/toml.hpp
  ${utils_SOURCE_DIR}/config.hpp)

set(UTIL_FILES
  ${utils_SOURCE_DIR}/converter.h
  ${utils_SOURCE_DIR}/converter.cpp
  ${utils_SOURCE_DIR}/clock.h
  ${utils_SOURCE_DIR}/clock.cpp
  ${utils_SOURCE_DIR}/utils.h
  ${utils_SOURCE_DIR}/utils.cpp
  #${utils_SOURCE_DIR}/bundle.h
  #${utils_SOURCE_DIR}/bundle.cpp # 编译错误，暂时不用，需要时再整
  )
  
set(Qt_FILES
  ${utils_SOURCE_DIR}/Qt/SkinedDialog.h
  ${utils_SOURCE_DIR}/Qt/SkinedDialog.cpp
  ${utils_SOURCE_DIR}/Qt/SplashScreen.h
  ${utils_SOURCE_DIR}/Qt/SplashScreen.cpp
  ${utils_SOURCE_DIR}/Qt/ShadowWidget.h
  ${utils_SOURCE_DIR}/Qt/ShadowWidget.cpp)

set(QtAwesome_FILES
  ${utils_SOURCE_DIR}/Qt/QtAwesome.cpp
  ${utils_SOURCE_DIR}/Qt/QtAwesome.h
  ${utils_SOURCE_DIR}/Qt/QtAwesomeAnim.cpp
  ${utils_SOURCE_DIR}/Qt/QtAwesomeAnim.h)
  
set(QtSound_FILES
  ${utils_SOURCE_DIR}/Qt/SoundSource.h
  ${utils_SOURCE_DIR}/Qt/SoundSource.cpp)
  
macro(use_utils ag_project_name)
  # include utils_SOURCE_DIR ==> third/utils
  target_include_directories(${ag_project_name} PRIVATE ${utils_SOURCE_DIR})
endmacro(use_utils)

# 使用 utils 中提供的预编译头文件
macro(use_pch ag_project_name)
  if (OS_WINDOWS)
    target_compile_definitions(${ag_project_name} PRIVATE USE_PRECOMPILE_HEADER)
    target_precompile_headers(${ag_project_name} PRIVATE ${PCH_FILE})
  else()
  endif()
endmacro(use_pch)